Условие:Вам даны две матрицы, нужно написать функцию для их умножения. Матрицы могут быть квадратными или прямоугольными.
Решение: Напишем решение на чистом Python
def matrix_multiply(A, B): # Сначала проверим, можем ли мы вообще перемножить эти матрицы if len(A[0]) != len(B): raise ValueError("Number of A columns must equal number of B rows.")
# Инициализируем результирующую матрицу, заполненную нулями result = [[0 for _ in range(len(B[0]))] for _ in range(len(A))]
# Перемножим матрицы for i in range(len(A)): for j in range(len(B[0])): for k in range(len(B)): result[i][j] += A[i][k] * B[k][j]
return result
# Проверим функцию на примере A = [[1, 2, 3], [4, 5, 6]]
B = [[7, 8], [9, 10], [11, 12]]
result = matrix_multiply(A, B) for row in result: print(row)
Условие:Вам даны две матрицы, нужно написать функцию для их умножения. Матрицы могут быть квадратными или прямоугольными.
Решение: Напишем решение на чистом Python
def matrix_multiply(A, B): # Сначала проверим, можем ли мы вообще перемножить эти матрицы if len(A[0]) != len(B): raise ValueError("Number of A columns must equal number of B rows.")
# Инициализируем результирующую матрицу, заполненную нулями result = [[0 for _ in range(len(B[0]))] for _ in range(len(A))]
# Перемножим матрицы for i in range(len(A)): for j in range(len(B[0])): for k in range(len(B)): result[i][j] += A[i][k] * B[k][j]
return result
# Проверим функцию на примере A = [[1, 2, 3], [4, 5, 6]]
B = [[7, 8], [9, 10], [11, 12]]
result = matrix_multiply(A, B) for row in result: print(row)
#программирование #линейная_алгебра
BY Библиотека собеса по Data Science | вопросы с собеседований
Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283
There are multiple ways you can search for Telegram channels. One of the methods is really logical and you should all know it by now. We’re talking about using Telegram’s native search option. Make sure to download Telegram from the official website or update it to the latest version, using this link. Once you’ve installed Telegram, you can simply open the app and use the search bar. Tap on the magnifier icon and search for a channel that might interest you (e.g. Marvel comics). Even though this is the easiest method for searching Telegram channels, it isn’t the best one. This method is limited because it shows you only a couple of results per search.
Look for Channels Online
You guessed it – the internet is your friend. A good place to start looking for Telegram channels is Reddit. This is one of the biggest sites on the internet, with millions of communities, including those from Telegram.Then, you can search one of the many dedicated websites for Telegram channel searching. One of them is telegram-group.com. This website has many categories and a really simple user interface. Another great site is telegram channels.me. It has even more channels than the previous one, and an even better user experience.These are just some of the many available websites. You can look them up online if you’re not satisfied with these two. All of these sites list only public channels. If you want to join a private channel, you’ll have to ask one of its members to invite you.
Библиотека собеса по Data Science | вопросы с собеседований from pl